package com.sky.mapper.admin;

import com.github.pagehelper.Page;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.Orders;
import com.sky.vo.OrderSearchVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Mapper
@Repository("adminOrdersMapper")
public interface OrdersMapper {

    Page<OrderSearchVo> selectPage(OrdersPageQueryDTO ordersPageQueryDTO);

    Integer selectStatus(Integer status);

    void update(Orders Orders);


    Orders selectById(Long id);

    // 订单统计
    Integer orderCount(Map map);

    // 订单列表
    List<String> orderCountList(Map map);


    @Select("select sum(amount) from orders where status = #{status} and order_time between #{beginTime} and #{endTime}")
    Double orderAmountSum(HashMap map);
}
